
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>0.3 安装必要的软件 · 《CMake Cookbook》中文版</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="陈晓伟 chenxiaowei">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="0.4-chinese.html" />
    
    
    <link rel="prev" href="0.2-chinese.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../preface/preface-chinese.html">
            
                <a href="../preface/preface-chinese.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="0.0-chinese.html">
            
                <a href="0.0-chinese.html">
            
                    
                    第0章 配置环境
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="0.1-chinese.html">
            
                <a href="0.1-chinese.html">
            
                    
                    0.1 获取代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="0.2-chinese.html">
            
                <a href="0.2-chinese.html">
            
                    
                    0.2 Docker镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.3" data-path="0.3-chinese.html">
            
                <a href="0.3-chinese.html">
            
                    
                    0.3 安装必要的软件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="0.4-chinese.html">
            
                <a href="0.4-chinese.html">
            
                    
                    0.4 测试环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="0.5-chinese.html">
            
                <a href="0.5-chinese.html">
            
                    
                    0.5 上报问题并提出改进建议
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter1/1.0-chinese.html">
            
                <a href="../chapter1/1.0-chinese.html">
            
                    
                    第1章 从可执行文件到库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter1/1.1-chinese.html">
            
                <a href="../chapter1/1.1-chinese.html">
            
                    
                    1.1 将单个源文件编译为可执行文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter1/1.2-chinese.html">
            
                <a href="../chapter1/1.2-chinese.html">
            
                    
                    1.2 切换生成器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter1/1.3-chinese.html">
            
                <a href="../chapter1/1.3-chinese.html">
            
                    
                    1.3 构建和链接静态库和动态库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter1/1.4-chinese.html">
            
                <a href="../chapter1/1.4-chinese.html">
            
                    
                    1.4 用条件句控制编译
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter1/1.5-chinese.html">
            
                <a href="../chapter1/1.5-chinese.html">
            
                    
                    1.5 向用户显示选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../chapter1/1.6-chinese.html">
            
                <a href="../chapter1/1.6-chinese.html">
            
                    
                    1.6 指定编译器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../chapter1/1.7-chinese.html">
            
                <a href="../chapter1/1.7-chinese.html">
            
                    
                    1.7 切换构建类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../chapter1/1.8-chinese.html">
            
                <a href="../chapter1/1.8-chinese.html">
            
                    
                    1.8 设置编译器选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../chapter1/1.9-chinese.html">
            
                <a href="../chapter1/1.9-chinese.html">
            
                    
                    1.9 为语言设定标准
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../chapter1/1.10-chinese.html">
            
                <a href="../chapter1/1.10-chinese.html">
            
                    
                    1.10 使用控制流
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter2/2.0-chinese.html">
            
                <a href="../chapter2/2.0-chinese.html">
            
                    
                    第2章 检测环境
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../chapter2/2.1-chinese.html">
            
                <a href="../chapter2/2.1-chinese.html">
            
                    
                    2.1 检测操作系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../chapter2/2.2-chinese.html">
            
                <a href="../chapter2/2.2-chinese.html">
            
                    
                    2.2 处理与平台相关的源代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter2/2.3-chinese.html">
            
                <a href="../chapter2/2.3-chinese.html">
            
                    
                    2.3 处理与编译器相关的源代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../chapter2/2.4-chinese.html">
            
                <a href="../chapter2/2.4-chinese.html">
            
                    
                    2.4 检测处理器体系结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../chapter2/2.5-chinese.html">
            
                <a href="../chapter2/2.5-chinese.html">
            
                    
                    2.5 检测处理器指令集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../chapter2/2.6-chinese.html">
            
                <a href="../chapter2/2.6-chinese.html">
            
                    
                    2.6 为Eigen库使能向量化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter3/3.0-chinese.html">
            
                <a href="../chapter3/3.0-chinese.html">
            
                    
                    第3章 检测外部库和程序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter3/3.1-chinese.html">
            
                <a href="../chapter3/3.1-chinese.html">
            
                    
                    3.1 检测Python解释器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter3/3.2-chinese.html">
            
                <a href="../chapter3/3.2-chinese.html">
            
                    
                    3.2 检测Python库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter3/3.3-chinese.html">
            
                <a href="../chapter3/3.3-chinese.html">
            
                    
                    3.3 检测Python模块和包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter3/3.4-chinese.html">
            
                <a href="../chapter3/3.4-chinese.html">
            
                    
                    3.4 检测BLAS和LAPACK数学库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../chapter3/3.5-chinese.html">
            
                <a href="../chapter3/3.5-chinese.html">
            
                    
                    3.5 检测OpenMP的并行环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../chapter3/3.6-chinese.html">
            
                <a href="../chapter3/3.6-chinese.html">
            
                    
                    3.6 检测MPI的并行环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../chapter3/3.7-chinese.html">
            
                <a href="../chapter3/3.7-chinese.html">
            
                    
                    3.7 检测Eigen库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../chapter3/3.8-chinese.html">
            
                <a href="../chapter3/3.8-chinese.html">
            
                    
                    3.8 检测Boost库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../chapter3/3.9-chinese.html">
            
                <a href="../chapter3/3.9-chinese.html">
            
                    
                    3.9 检测外部库:Ⅰ. 使用pkg-config
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../chapter3/3.10-chinese.html">
            
                <a href="../chapter3/3.10-chinese.html">
            
                    
                    3.10 检测外部库:Ⅱ. 自定义find模块
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter4/4.0-chinese.html">
            
                <a href="../chapter4/4.0-chinese.html">
            
                    
                    第4章 创建和运行测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter4/4.1-chinese.html">
            
                <a href="../chapter4/4.1-chinese.html">
            
                    
                    4.1 创建一个简单的单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter4/4.2-chinese.html">
            
                <a href="../chapter4/4.2-chinese.html">
            
                    
                    4.2 使用Catch2库进行单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter4/4.3-chinese.html">
            
                <a href="../chapter4/4.3-chinese.html">
            
                    
                    4.3 使用Google Test库进行单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter4/4.4-chinese.html">
            
                <a href="../chapter4/4.4-chinese.html">
            
                    
                    4.4 使用Boost Test进行单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter4/4.5-chinese.html">
            
                <a href="../chapter4/4.5-chinese.html">
            
                    
                    4.5 使用动态分析来检测内存缺陷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter4/4.6-chinese.html">
            
                <a href="../chapter4/4.6-chinese.html">
            
                    
                    4.6 预期测试失败
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../chapter4/4.7-chinese.html">
            
                <a href="../chapter4/4.7-chinese.html">
            
                    
                    4.7 使用超时测试运行时间过长的测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../chapter4/4.8-chinese.html">
            
                <a href="../chapter4/4.8-chinese.html">
            
                    
                    4.8 并行测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../chapter4/4.9-chinese.html">
            
                <a href="../chapter4/4.9-chinese.html">
            
                    
                    4.9 运行测试子集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../chapter4/4.10-chinese.html">
            
                <a href="../chapter4/4.10-chinese.html">
            
                    
                    4.10 使用测试固件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../chapter5/5.0-chinese.html">
            
                <a href="../chapter5/5.0-chinese.html">
            
                    
                    第5章 配置时和构建时的操作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter5/5.1-chinese.html">
            
                <a href="../chapter5/5.1-chinese.html">
            
                    
                    5.1 使用平台无关的文件操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter5/5.2-chinese.html">
            
                <a href="../chapter5/5.2-chinese.html">
            
                    
                    5.2 配置时运行自定义命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../chapter5/5.3-chinese.html">
            
                <a href="../chapter5/5.3-chinese.html">
            
                    
                    5.3 构建时运行自定义命令:Ⅰ. 使用add_custom_command
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../chapter5/5.4-chinese.html">
            
                <a href="../chapter5/5.4-chinese.html">
            
                    
                    5.4 构建时运行自定义命令:Ⅱ. 使用add_custom_target
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../chapter5/5.5-chinese.html">
            
                <a href="../chapter5/5.5-chinese.html">
            
                    
                    5.5 构建时为特定目标运行自定义命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../chapter5/5.6-chinese.html">
            
                <a href="../chapter5/5.6-chinese.html">
            
                    
                    5.6 探究编译和链接命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../chapter5/5.7-chinese.html">
            
                <a href="../chapter5/5.7-chinese.html">
            
                    
                    5.7 探究编译器标志命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../chapter5/5.8-chinese.html">
            
                <a href="../chapter5/5.8-chinese.html">
            
                    
                    5.8 探究可执行命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../chapter5/5.9-chinese.html">
            
                <a href="../chapter5/5.9-chinese.html">
            
                    
                    5.9 使用生成器表达式微调配置和编译
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../chapter6/6.0-chinese.html">
            
                <a href="../chapter6/6.0-chinese.html">
            
                    
                    第6章 生成源码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../chapter6/6.1-chinese.html">
            
                <a href="../chapter6/6.1-chinese.html">
            
                    
                    6.1 配置时生成源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../chapter6/6.2-chinese.html">
            
                <a href="../chapter6/6.2-chinese.html">
            
                    
                    6.2 使用Python在配置时生成源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../chapter6/6.3-chinese.html">
            
                <a href="../chapter6/6.3-chinese.html">
            
                    
                    6.3 构建时使用Python生成源码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../chapter6/6.4-chinese.html">
            
                <a href="../chapter6/6.4-chinese.html">
            
                    
                    6.4 记录项目版本信息以便报告
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../chapter6/6.5-chinese.html">
            
                <a href="../chapter6/6.5-chinese.html">
            
                    
                    6.5 从文件中记录项目版本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" data-path="../chapter6/6.6-chinese.html">
            
                <a href="../chapter6/6.6-chinese.html">
            
                    
                    6.6 配置时记录Git Hash值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" data-path="../chapter6/6.7-chinese.html">
            
                <a href="../chapter6/6.7-chinese.html">
            
                    
                    6.7 构建时记录Git Hash值
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../chapter7/7.0-chinese.html">
            
                <a href="../chapter7/7.0-chinese.html">
            
                    
                    第7章 构建项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../chapter7/7.1-chinese.html">
            
                <a href="../chapter7/7.1-chinese.html">
            
                    
                    7.1 使用函数和宏重用代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../chapter7/7.2-chinese.html">
            
                <a href="../chapter7/7.2-chinese.html">
            
                    
                    7.2 将CMake源代码分成模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../chapter7/7.3-chinese.html">
            
                <a href="../chapter7/7.3-chinese.html">
            
                    
                    7.3 编写函数来测试和设置编译器标志
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../chapter7/7.4-chinese.html">
            
                <a href="../chapter7/7.4-chinese.html">
            
                    
                    7.4 用指定参数定义函数或宏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../chapter7/7.5-chinese.html">
            
                <a href="../chapter7/7.5-chinese.html">
            
                    
                    7.5 重新定义函数和宏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../chapter7/7.6-chinese.html">
            
                <a href="../chapter7/7.6-chinese.html">
            
                    
                    7.6 使用废弃函数、宏和变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../chapter7/7.7-chinese.html">
            
                <a href="../chapter7/7.7-chinese.html">
            
                    
                    7.7 add_subdirectory的限定范围
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../chapter7/7.8-chinese.html">
            
                <a href="../chapter7/7.8-chinese.html">
            
                    
                    7.8 使用target_sources避免全局变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../chapter7/7.9-chinese.html">
            
                <a href="../chapter7/7.9-chinese.html">
            
                    
                    7.9 组织Fortran项目
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../chapter8/8.0-chinese.html">
            
                <a href="../chapter8/8.0-chinese.html">
            
                    
                    第8章 超级构建模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../chapter8/8.1-chinese.html">
            
                <a href="../chapter8/8.1-chinese.html">
            
                    
                    8.1 使用超级构建模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../chapter8/8.2-chinese.html">
            
                <a href="../chapter8/8.2-chinese.html">
            
                    
                    8.2 使用超级构建管理依赖项:Ⅰ.Boost库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../chapter8/8.3-chinese.html">
            
                <a href="../chapter8/8.3-chinese.html">
            
                    
                    8.3 使用超级构建管理依赖项:Ⅱ.FFTW库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../chapter8/8.4-chinese.html">
            
                <a href="../chapter8/8.4-chinese.html">
            
                    
                    8.4 使用超级构建管理依赖项:Ⅲ.Google Test框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../chapter8/8.5-chinese.html">
            
                <a href="../chapter8/8.5-chinese.html">
            
                    
                    8.5 使用超级构建支持项目
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../chapter9/9.0-chinese.html">
            
                <a href="../chapter9/9.0-chinese.html">
            
                    
                    第9章 语言混合项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../chapter9/9.1-chinese.html">
            
                <a href="../chapter9/9.1-chinese.html">
            
                    
                    9.1 使用C/C++库构建Fortran项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../chapter9/9.2-chinese.html">
            
                <a href="../chapter9/9.2-chinese.html">
            
                    
                    9.2 使用Fortran库构建C/C++项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../chapter9/9.3-chinese.html">
            
                <a href="../chapter9/9.3-chinese.html">
            
                    
                    9.3 使用Cython构建C++和Python项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../chapter9/9.4-chinese.html">
            
                <a href="../chapter9/9.4-chinese.html">
            
                    
                    9.4 使用Boost.Python构建C++和Python项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../chapter9/9.5-chinese.html">
            
                <a href="../chapter9/9.5-chinese.html">
            
                    
                    9.5 使用pybind11构建C++和Python项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../chapter9/9.6-chinese.html">
            
                <a href="../chapter9/9.6-chinese.html">
            
                    
                    9.6 使用Python CFFI混合C，C++，Fortran和Python
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../chapter10/10.0-chinese.html">
            
                <a href="../chapter10/10.0-chinese.html">
            
                    
                    第10章 编写安装程序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../chapter10/10.1-chinese.html">
            
                <a href="../chapter10/10.1-chinese.html">
            
                    
                    10.1 安装项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../chapter10/10.2-chinese.html">
            
                <a href="../chapter10/10.2-chinese.html">
            
                    
                    10.2 生成输出头文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../chapter10/10.3-chinese.html">
            
                <a href="../chapter10/10.3-chinese.html">
            
                    
                    10.3 输出目标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../chapter10/10.4-chinese.html">
            
                <a href="../chapter10/10.4-chinese.html">
            
                    
                    10.4 安装超级构建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../chapter11/11.0-chinese.html">
            
                <a href="../chapter11/11.0-chinese.html">
            
                    
                    第11章 打包项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../chapter11/11.1-chinese.html">
            
                <a href="../chapter11/11.1-chinese.html">
            
                    
                    11.1 生成源代码和二进制包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../chapter11/11.2-chinese.html">
            
                <a href="../chapter11/11.2-chinese.html">
            
                    
                    11.2 通过PyPI发布使用CMake/pybind11构建的C++/Python项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../chapter11/11.3-chinese.html">
            
                <a href="../chapter11/11.3-chinese.html">
            
                    
                    11.3 通过PyPI发布使用CMake/CFFI构建C/Fortran/Python项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.4" data-path="../chapter11/11.4-chinese.html">
            
                <a href="../chapter11/11.4-chinese.html">
            
                    
                    11.4 以Conda包的形式发布一个简单的项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.5" data-path="../chapter11/11.5-chinese.html">
            
                <a href="../chapter11/11.5-chinese.html">
            
                    
                    11.5 将Conda包作为依赖项发布给项目
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../chapter12/12.0-chinese.html">
            
                <a href="../chapter12/12.0-chinese.html">
            
                    
                    第12章 构建文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../chapter12/12.1-chinese.html">
            
                <a href="../chapter12/12.1-chinese.html">
            
                    
                    12.1 使用Doxygen构建文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../chapter12/12.2-chinese.html">
            
                <a href="../chapter12/12.2-chinese.html">
            
                    
                    12.2 使用Sphinx构建文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../chapter12/12.3-chinese.html">
            
                <a href="../chapter12/12.3-chinese.html">
            
                    
                    12.3 结合Doxygen和Sphinx
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../chapter13/13.0-chinese.html">
            
                <a href="../chapter13/13.0-chinese.html">
            
                    
                    第13章 选择生成器和交叉编译
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../chapter13/13.1-chinese.html">
            
                <a href="../chapter13/13.1-chinese.html">
            
                    
                    13.1 使用CMake构建Visual Studio 2017项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../chapter13/13.2-chinese.html">
            
                <a href="../chapter13/13.2-chinese.html">
            
                    
                    13.2 交叉编译hello world示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../chapter13/13.3-chinese.html">
            
                <a href="../chapter13/13.3-chinese.html">
            
                    
                    13.3 使用OpenMP并行化交叉编译Windows二进制文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../chapter14/14.0-chinese.html">
            
                <a href="../chapter14/14.0-chinese.html">
            
                    
                    第14章 测试面板
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../chapter14/14.1-chinese.html">
            
                <a href="../chapter14/14.1-chinese.html">
            
                    
                    14.1 将测试部署到CDash
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../chapter14/14.2-chinese.html">
            
                <a href="../chapter14/14.2-chinese.html">
            
                    
                    14.2 CDash显示测试覆盖率
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../chapter14/14.3-chinese.html">
            
                <a href="../chapter14/14.3-chinese.html">
            
                    
                    14.3 使用AddressSanifier向CDash报告内存缺陷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../chapter14/14.4-chinese.html">
            
                <a href="../chapter14/14.4-chinese.html">
            
                    
                    14.4 使用ThreadSaniiser向CDash报告数据争用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../chapter15/15.0-chinese.html">
            
                <a href="../chapter15/15.0-chinese.html">
            
                    
                    第15章 使用CMake构建已有项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../chapter15/15.1-chinese.html">
            
                <a href="../chapter15/15.1-chinese.html">
            
                    
                    15.1 如何开始迁移项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../chapter15/15.2-chinese.html">
            
                <a href="../chapter15/15.2-chinese.html">
            
                    
                    15.2 生成文件并编写平台检查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../chapter15/15.3-chinese.html">
            
                <a href="../chapter15/15.3-chinese.html">
            
                    
                    15.3 检测所需的链接和依赖关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.4" data-path="../chapter15/15.4-chinese.html">
            
                <a href="../chapter15/15.4-chinese.html">
            
                    
                    15.4 复制编译标志
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.5" data-path="../chapter15/15.5-chinese.html">
            
                <a href="../chapter15/15.5-chinese.html">
            
                    
                    15.5 移植测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.6" data-path="../chapter15/15.6-chinese.html">
            
                <a href="../chapter15/15.6-chinese.html">
            
                    
                    15.6 移植安装目标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.7" data-path="../chapter15/15.7-chinese.html">
            
                <a href="../chapter15/15.7-chinese.html">
            
                    
                    15.7 进一步迁移的措施
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.8" data-path="../chapter15/15.8-chinese.html">
            
                <a href="../chapter15/15.8-chinese.html">
            
                    
                    15.8 项目转换为CMake的常见问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../chapter16/16.0-chinese.html">
            
                <a href="../chapter16/16.0-chinese.html">
            
                    
                    第16章 可能感兴趣的书
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.19.1" data-path="../chapter16/16.1-chinese.html">
            
                <a href="../chapter16/16.1-chinese.html">
            
                    
                    16.1 留下评论——让其他读者知道你的想法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="http://www.bczl.xyz/" target="blank" class="gitbook-link">
            编程之路
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >0.3 安装必要的软件</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="03-&#x5B89;&#x88C5;&#x5FC5;&#x8981;&#x7684;&#x8F6F;&#x4EF6;">0.3 &#x5B89;&#x88C5;&#x5FC5;&#x8981;&#x7684;&#x8F6F;&#x4EF6;</h1>
<p>&#x4E0E;&#x5728;Docker&#x4E2D;&#x4F7F;&#x7528;&#x4E0D;&#x540C;&#xFF0C;&#x53E6;&#x4E00;&#x79CD;&#x9009;&#x62E9;&#x662F;&#x76F4;&#x63A5;&#x5728;&#x4E3B;&#x673A;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E0A;&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#x9879;&#x3002;&#x4E3A;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x6982;&#x62EC;&#x4E86;&#x4E00;&#x4E2A;&#x5DE5;&#x5177;&#x6808;&#xFF0C;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x793A;&#x4F8B;&#x7684;&#x57FA;&#x7840;&#x3002;&#x60A8;&#x5FC5;&#x987B;&#x5B89;&#x88C5;&#x4EE5;&#x4E0B;&#x7EC4;&#x4EF6;&#xFF1A;</p>
<ol>
<li>CMake</li>
<li>&#x7F16;&#x8BD1;&#x5668;</li>
<li>&#x81EA;&#x52A8;&#x5316;&#x6784;&#x5EFA;&#x5DE5;&#x5177;</li>
<li>Python</li>
</ol>
<p>&#x6211;&#x4EEC;&#x8FD8;&#x4F1A;&#x8BE6;&#x7EC6;&#x4ECB;&#x7ECD;&#xFF0C;&#x5982;&#x4F55;&#x5B89;&#x88C5;&#x6240;&#x9700;&#x7684;&#x67D0;&#x4E9B;&#x4F9D;&#x8D56;&#x9879;&#x3002;</p>
<h2 id="031-&#x83B7;&#x53D6;cmake">0.3.1 &#x83B7;&#x53D6;CMake</h2>
<p>&#x672C;&#x4E66;&#x8981;&#x4F7F;&#x7528;&#x7684;CMake&#x6700;&#x4F4E;&#x9700;&#x8981;&#x4E3A;3.5&#x3002;&#x53EA;&#x6709;&#x5C11;&#x6570;&#x793A;&#x4F8B;&#xFF0C;&#x6F14;&#x793A;&#x4E86;3.5&#x7248;&#x4E4B;&#x540E;&#x5F15;&#x5165;&#x7684;&#x65B0;&#x529F;&#x80FD;&#x3002;&#x6BCF;&#x4E2A;&#x793A;&#x4F8B;&#x90FD;&#x6709;&#x63D0;&#x793A;&#xFF0C;&#x6307;&#x51FA;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x5728;&#x54EA;&#x91CC;&#x53EF;&#x7528;&#xFF0C;&#x4EE5;&#x53CA;&#x6240;&#x9700;&#x7684;CMake&#x7684;&#x6700;&#x4F4E;&#x7248;&#x672C;&#x3002;&#x63D0;&#x793A;&#x4FE1;&#x606F;&#x5982;&#x4E0B;:</p>
<p><strong>NOTE</strong>:<em>&#x8FD9;&#x4E2A;&#x793A;&#x4F8B;&#x7684;&#x4EE3;&#x7801;&#x53EF;&#x4EE5;&#x5728; <a href="https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-03/recipe10" target="_blank">https://github.com/dev-cafe/cmake-cookbook/tree/v1.0/chapter-03/recipe10</a> &#x4E2D;&#x627E;&#x5230;&#xFF0C;&#x5176;&#x4E2D;&#x5305;&#x62EC;&#x4E00;&#x4E2A;C&#x793A;&#x4F8B;&#x3002;&#x8BE5;&#x793A;&#x4F8B;&#x5728;CMake 3.5&#x7248;(&#x6216;&#x66F4;&#x9AD8;&#x7248;&#x672C;)&#x4E2D;&#x662F;&#x6709;&#x6548;&#x7684;&#xFF0C;&#x5E76;&#x4E14;&#x5DF2;&#x7ECF;&#x5728;GNU/Linux&#x3001;macOS&#x548C;Windows&#x4E0A;&#x8FDB;&#x884C;&#x4E86;&#x6D4B;&#x8BD5;&#x3002;</em></p>
<p>&#x6709;&#x4E9B;(&#x5982;&#x679C;&#x4E0D;&#x662F;&#x5927;&#x591A;&#x6570;)&#x793A;&#x4F8B;&#x4ECD;&#x7136;&#x9002;&#x7528;&#x4E8E;&#x8F83;&#x4F4E;&#x7248;&#x672C;&#x7684;CMake&#x3002;&#x4F46;&#x662F;&#xFF0C;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x6D4B;&#x8BD5;&#x8FC7;&#x8FD9;&#x4E2A;&#x3002;&#x6211;&#x4EEC;&#x8BA4;&#x4E3A;CMake 3.5&#x662F;&#x5927;&#x591A;&#x6570;&#x7CFB;&#x7EDF;&#x548C;&#x53D1;&#x884C;&#x7248;&#x7684;&#x9ED8;&#x8BA4;&#x8F6F;&#x4EF6;&#xFF0C;&#x800C;&#x4E14;&#x5347;&#x7EA7;CMake&#x4E5F;&#x6CA1;&#x4EC0;&#x4E48;&#x96BE;&#x5EA6;&#x3002;</p>
<p>CMake&#x53EF;&#x4EE5;&#x4EE5;&#x591A;&#x79CD;&#x65B9;&#x5F0F;&#x5B89;&#x88C5;&#x3002;&#x4E0B;&#x8F7D;&#x5E76;&#x63D0;&#x53D6;&#x7531;Kitware&#x7EF4;&#x62A4;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x53D1;&#x884C;&#x7248;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x6240;&#x6709;&#x5E73;&#x53F0;&#x4E0A;&#x8FD0;&#x884C;&#xFF0C;&#x4E0B;&#x8F7D;&#x9875;&#x9762;&#x4F4D;&#x4E8E; <a href="https://cmake.org/download/" target="_blank">https://cmake.org/download/</a> &#x3002;</p>
<p>&#x5927;&#x591A;&#x6570;GNU/Linux&#x53D1;&#x884C;&#x7248;&#x90FD;&#x5728;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x4E2D;&#x63D0;&#x4F9B;&#x4E86;CMake&#x3002;&#x7136;&#x800C;&#xFF0C;&#x5728;&#x4E00;&#x4E9B;&#x53D1;&#x884C;&#x7248;&#x4E2D;&#xFF0C;&#x7248;&#x672C;&#x53EF;&#x80FD;&#x6BD4;&#x8F83;&#x65E7;&#xFF0C;&#x56E0;&#x6B64;&#x4E0B;&#x8F7D;&#x7531;Kitware&#x63D0;&#x4F9B;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#x5F53;&#x7136;&#x662F;&#x9996;&#x9009;&#x3002;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#x5C06;&#x4ECE;CMake&#x6253;&#x5305;&#x7684;&#x7248;&#x672C;&#x4E2D;&#x4E0B;&#x8F7D;&#x5E76;&#x5B89;&#x88C5;&#x5728;<code>$HOME/Deps/CMake</code>(&#x6839;&#x636E;&#x60A8;&#x7684;&#x504F;&#x597D;&#x8C03;&#x6574;&#x6B64;&#x8DEF;&#x5F84;)&#x4E0B;&#x7684;CMake 3.5.2&#xFF1A;</p>
<pre><code class="lang-shell">$ cmake_version=&quot;3.5.2&quot;
$ target_path=$HOME/Deps/cmake/${cmake_version}
$ cmake_url=&quot;https://cmake.org/files/v${cmake_version%.*}/cmake-${cmake_version}-Linux-x86_64.tar.gz&quot;
$ mkdir -p &quot;${target_path}&quot;
$ curl -Ls &quot;${cmake_url}&quot; | tar -xz -C &quot;${target_path}&quot; --strip-components=1
$ export PATH=$HOME/Deps/cmake/${cmake_version}/bin${PATH:+:$PATH}
$ cmake --version
</code></pre>
<p>macOS&#x83B7;&#x53D6;&#x6700;&#x65B0;&#x7248;&#x672C;&#x7684;CMake&#xFF1A;</p>
<pre><code class="lang-shell">$ brew upgrade cmake
</code></pre>
<p>Windows&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;Visual Studio 2017&#xFF0C;&#x5B83;&#x63D0;&#x4F9B;&#x4E86;CMake&#x652F;&#x6301;&#x3002;Visual Studio 2017&#x7684;&#x5B89;&#x88C5;&#x8BB0;&#x5F55;&#x5728;&#x7B2C;13&#x7AE0;&#xFF0C;<em>&#x53EF;&#x9009;&#x751F;&#x6210;&#x5668;&#x548C;&#x4EA4;&#x53C9;&#x7F16;&#x8BD1;</em>&#xFF0C;&#x793A;&#x4F8B;&#x6280;&#x5DE7;1&#xFF0C;<em>&#x4F7F;&#x7528;Visual Studio 2017&#x6784;&#x5EFA;CMake&#x9879;&#x76EE;</em>&#x3002;</p>
<p>&#x6216;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE; <a href="https://www.msys2.org" target="_blank">https://www.msys2.org</a> &#x4E0B;&#x8F7D;MSYS2&#x5B89;&#x88C5;&#x7A0B;&#x5E8F;&#xFF0C;&#x6309;&#x7167;&#x5176;&#x4E2D;&#x7ED9;&#x51FA;&#x7684;&#x8BF4;&#x660E;&#x66F4;&#x65B0;&#x5305;&#x5217;&#x8868;&#xFF0C;&#x7136;&#x540E;&#x4F7F;&#x7528;&#x5305;&#x7BA1;&#x7406;&#x5668;<code>pacman</code>&#x5B89;&#x88C5;CMake&#x3002;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x6B63;&#x5728;&#x6784;&#x5EFA;64&#x4F4D;&#x7248;&#x672C;&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-cmake
</code></pre>
<p>&#x5BF9;&#x4E8E;32&#x4F4D;&#x7248;&#x672C;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;(&#x4E3A;&#x4E86;&#x7B80;&#x5355;&#x8D77;&#x89C1;&#xFF0C;&#x6211;&#x4EEC;&#x4EE5;&#x540E;&#x53EA;&#x4F1A;&#x63D0;&#x5230;64&#x4F4D;&#x7248;&#x672C;)&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-i686-cmake
</code></pre>
<p>MSYS2&#x7684;&#x53E6;&#x4E00;&#x4E2A;&#x7279;&#x6027;&#x662F;&#x5728;Windows&#x4E0A;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x7EC8;&#x7AEF;&#xFF0C;&#x6BD4;&#x8F83;&#x50CF;Unix&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x4E0A;&#x7684;&#x7EC8;&#x7AEF;&#xFF0C;&#x63D0;&#x4F9B;&#x53EF;&#x7528;&#x7684;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x3002;</p>
<h2 id="032-&#x7F16;&#x8BD1;&#x5668;">0.3.2 &#x7F16;&#x8BD1;&#x5668;</h2>
<p>&#x6211;&#x4EEC;&#x5C06;&#x9700;&#x8981;C++&#x3001;C&#x548C;Fortran&#x7684;&#x7F16;&#x8BD1;&#x5668;&#x3002;&#x7F16;&#x8BD1;&#x5668;&#x7684;&#x7248;&#x672C;&#x9700;&#x8981;&#x6BD4;&#x8F83;&#x65B0;&#xFF0C;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5728;&#x5927;&#x591A;&#x6570;&#x793A;&#x4F8B;&#x4E2D;&#x652F;&#x6301;&#x6700;&#x65B0;&#x7684;&#x8BED;&#x8A00;&#x6807;&#x51C6;&#x3002;CMake&#x4E3A;&#x6765;&#x81EA;&#x5546;&#x4E1A;&#x548C;&#x975E;&#x5546;&#x4E1A;&#x4F9B;&#x5E94;&#x5546;&#x7684;&#x8BB8;&#x591A;&#x7F16;&#x8BD1;&#x5668;&#xFF0C;&#x63D0;&#x4F9B;&#x4E86;&#x975E;&#x5E38;&#x597D;&#x7684;&#x652F;&#x6301;&#x3002;&#x4E3A;&#x4E86;&#x8BA9;&#x793A;&#x4F8B;&#x59CB;&#x7EC8;&#x80FD;&#x591F;&#x8DE8;&#x5E73;&#x53F0;&#xFF0C;&#x5E76;&#x5C3D;&#x53EF;&#x80FD;&#x72EC;&#x7ACB;&#x4E8E;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#xFF0C;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E86;&#x5F00;&#x6E90;&#x7F16;&#x8BD1;&#x5668;:</p>
<ul>
<li><p>GNU/Linux&#x4E0A;&#xFF0C;GNU&#x7F16;&#x8BD1;&#x5668;&#x96C6;&#x5408;(GCC)&#x662F;&#x76F4;&#x63A5;&#x7684;&#x9009;&#x62E9;&#x3002;&#x5B83;&#x662F;&#x514D;&#x8D39;&#x7684;&#xFF0C;&#x9002;&#x7528;&#x4E8E;&#x6240;&#x6709;&#x53D1;&#x884C;&#x7248;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5728;Ubuntu&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x5B89;&#x88C5;&#x4EE5;&#x4E0B;&#x7F16;&#x8BD1;&#x5668;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install g++ gcc gfortran
</code></pre>
</li>
<li><p>&#x5728;LLVM&#x5BB6;&#x65CF;&#x4E2D;&#xFF0C;Clang&#x4E5F;&#x662F;C++&#x548C;C&#x7F16;&#x8BD1;&#x5668;&#x7684;&#x4E00;&#x4E2A;&#x5F88;&#x597D;&#x7684;&#x9009;&#x62E9;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install clang clang++ gfortran
</code></pre>
</li>
<li><p>macOS&#x4E0A;&#xFF0C;XCode&#x9644;&#x5E26;&#x7684;LLVM&#x7F16;&#x8BD1;&#x5668;&#x9002;&#x7528;&#x4E8E;C++&#x548C;C&#x3002;&#x6211;&#x4EEC;&#x5728;macOS&#x6D4B;&#x8BD5;&#x4E2D;&#x4F7F;&#x7528;&#x4E86;GCC&#x7684;Fortran&#x7F16;&#x8BD1;&#x5668;&#x3002;GCC&#x7F16;&#x8BD1;&#x5668;&#x5FC5;&#x987B;&#x4F7F;&#x7528;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x5355;&#x72EC;&#x5B89;&#x88C5;&#xFF1A;</p>
<pre><code class="lang-shell">$ brew install gcc
</code></pre>
</li>
<li><p>Windows&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;Visual Studio&#x6D4B;&#x8BD5;C++&#x548C;C&#x793A;&#x4F8B;&#x3002;&#x6216;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;MSYS2&#x5B89;&#x88C5;&#x7A0B;&#x5E8F;&#xFF0C;MSYS2&#x73AF;&#x5883;&#x4E2D;(&#x5BF9;&#x4E8E;64&#x4F4D;&#x7248;&#x672C;)&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x5355;&#x4E2A;&#x547D;&#x4EE4;&#x5B89;&#x88C5;&#x6574;&#x4E2A;&#x5DE5;&#x5177;&#x94FE;&#xFF0C;&#x5305;&#x62EC;C++&#x3001;C&#x548C;Fortran&#x7F16;&#x8BD1;&#x5668;&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-toolchain
</code></pre>
</li>
</ul>
<h2 id="033-&#x81EA;&#x52A8;&#x5316;&#x6784;&#x5EFA;&#x5DE5;&#x5177;">0.3.3 &#x81EA;&#x52A8;&#x5316;&#x6784;&#x5EFA;&#x5DE5;&#x5177;</h2>
<p>&#x81EA;&#x52A8;&#x5316;&#x6784;&#x5EFA;&#x5DE5;&#x5177;&#x4E3A;&#x793A;&#x4F8B;&#x4E2D;&#x7684;&#x9879;&#x76EE;&#x63D0;&#x4F9B;&#x6784;&#x5EFA;&#x548C;&#x94FE;&#x63A5;&#x7684;&#x57FA;&#x7840;&#x8BBE;&#x65BD;&#xFF0C;&#x6700;&#x7EC8;&#x4F1A;&#x5B89;&#x88C5;&#x548C;&#x4F7F;&#x7528;&#x4EC0;&#x4E48;&#xFF0C;&#x5F88;&#x5927;&#x7A0B;&#x5EA6;&#x4E0A;&#x53D6;&#x51B3;&#x4E8E;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#xFF1A;</p>
<ul>
<li>GNU/Linux&#x4E0A;&#xFF0C;GNU Make(&#x5F88;&#x53EF;&#x80FD;)&#x5728;&#x5B89;&#x88C5;&#x7F16;&#x8BD1;&#x5668;&#x65F6;&#x81EA;&#x52A8;&#x5B89;&#x88C5;&#x3002;</li>
<li>macOS&#x4E0A;&#xFF0C;XCode&#x5C06;&#x63D0;&#x4F9B;GNU Make&#x3002;</li>
<li>Windows&#x4E0A;&#xFF0C;Visual Studio&#x63D0;&#x4F9B;&#x4E86;&#x5B8C;&#x6574;&#x7684;&#x57FA;&#x7840;&#x8BBE;&#x65BD;&#x3002;MSYS2&#x73AF;&#x5883;&#x4E2D;&#xFF0C;GNU Make&#x4F5C;&#x4E3A;mingw64/mingw-w64-x86_64&#x5DE5;&#x5177;&#x94FE;&#x5305;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x8FDB;&#x884C;&#x5B89;&#x88C5;&#x3002;</li>
</ul>
<p>&#x4E3A;&#x4E86;&#x83B7;&#x5F97;&#x6700;&#x5927;&#x7684;&#x53EF;&#x79FB;&#x690D;&#x6027;&#xFF0C;&#x6211;&#x4EEC;&#x5C3D;&#x53EF;&#x80FD;&#x4F7F;&#x793A;&#x4F8B;&#x4E0D;&#x53D7;&#x8FD9;&#x4E9B;&#x7CFB;&#x7EDF;&#x76F8;&#x5173;&#x7EC6;&#x8282;&#x7684;&#x5F71;&#x54CD;&#x3002;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x7684;&#x4F18;&#x70B9;&#x662F;&#x914D;&#x7F6E;&#x3001;&#x6784;&#x5EFA;&#x548C;&#x94FE;&#x63A5;&#xFF0C;&#x662F;&#x6BCF;&#x4E2A;&#x7F16;&#x8BD1;&#x5668;&#x7684;<em>&#x56FA;&#x6709;&#x7279;&#x6027;</em>&#x3002;</p>
<p>Ninja&#x662F;&#x4E00;&#x4E2A;&#x4E0D;&#x9519;&#x7684;&#x81EA;&#x52A8;&#x5316;&#x6784;&#x5EFA;&#x5DE5;&#x5177;&#xFF0C;&#x9002;&#x7528;&#x4E8E;GNU/Linux&#x3001;macOS&#x548C;Windows&#x3002;Ninja&#x6CE8;&#x91CD;&#x901F;&#x5EA6;&#xFF0C;&#x7279;&#x522B;&#x662F;&#x589E;&#x91CF;&#x91CD;&#x6784;&#x3002;&#x4E3A;GNU/Linux&#x3001;macOS&#x548C;Windows&#x9884;&#x5148;&#x6253;&#x5305;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#x53EF;&#x4EE5;&#x5728;GitHub&#x5E93;&#x4E2D;&#x627E;&#x5230;&#xFF0C;&#x7F51;&#x5740;&#x662F; <a href="https://github.com/ninja-build/ninja/releases" target="_blank">https://github.com/ninja-build/ninja/releases</a> &#x3002;</p>
<p>Fortran&#x9879;&#x76EE;&#x4E2D;&#x4F7F;&#x7528;CMake&#x548C;Ninja&#x9700;&#x8981;&#x6CE8;&#x610F;&#x3002;&#x4F7F;&#x7528;CMake 3.7.2&#x6216;&#x66F4;&#x9AD8;&#x7248;&#x672C;&#x662F;&#x5FC5;&#x8981;&#x7684;&#xFF0C;Kitware&#x8FD8;&#x6709;&#x7EF4;&#x62A4;Ninja&#xFF0C;&#x76F8;&#x5173;&#x5305;&#x53EF;&#x4EE5;&#x5728; <a href="https://github.com/Kitware/ninja/releases" target="_blank">https://github.com/Kitware/ninja/releases</a> &#x4E0A;&#x627E;&#x5230;&#x3002;</p>
<p>&#x5728;GNU/Linux&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x4E00;&#x7CFB;&#x5217;&#x547D;&#x4EE4;&#x5B89;&#x88C5;Ninja&#xFF1A;</p>
<pre><code class="lang-shell">$ mkdir -p ninja
$ ninja_url=&quot;https://github.com/Kitware/ninja/releases/download/v1.8.2.g3bbbe.kitware.dyndep-1.jobserver-1/ninja-1.8.2.g3bbbe.kitware.dyndep-1.jobserver-1_x86_64-linux-gnu.tar.gz&quot;
$ curl -Ls ${ninja_url} | tar -xz -C ninja --strip-components=1
$ export PATH=$HOME/Deps/ninja${PATH:+:$PATH}
</code></pre>
<p>Windows&#x4E0A;&#xFF0C;&#x4F7F;&#x7528;MSYS2&#x73AF;&#x5883;(&#x5047;&#x8BBE;&#x662F;64&#x4F4D;&#x7248;&#x672C;)&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-ninja
</code></pre>
<p><strong>NOTE</strong>:<em>&#x6211;&#x4EEC;&#x5EFA;&#x8BAE;&#x9605;&#x8BFB;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0; <a href="http://www.aosabook.org/en/posa/ninja.html" target="_blank">http://www.aosabook.org/en/posa/ninja.html</a> &#xFF0C;&#x91CC;&#x9762;&#x662F;&#x5BF9;NInja&#x7F16;&#x8BD1;&#x5668;&#x7684;&#x5386;&#x53F2;&#x548C;&#x8BBE;&#x8BA1;&#x7684;&#x9009;&#x62E9;&#xFF0C;&#x8FDB;&#x884C;&#x542F;&#x53D1;&#x6027;&#x7684;&#x8BA8;&#x8BBA;&#x3002;</em></p>
<h2 id="034-python">0.3.4 Python</h2>
<p>&#x672C;&#x4E66;&#x4E3B;&#x8981;&#x5173;&#x4E8E;CMake&#xFF0C;&#x4F46;&#x662F;&#x5176;&#x4E2D;&#x7684;&#x4E00;&#x4E9B;&#x65B9;&#x6CD5;&#xFF0C;&#x9700;&#x8981;&#x4F7F;&#x7528;Python&#x3002;&#x56E0;&#x6B64;&#xFF0C;&#x4E5F;&#x9700;&#x8981;&#x5BF9;Python&#x8FDB;&#x884C;&#x5B89;&#x88C5;&#xFF1A;&#x89E3;&#x91CA;&#x5668;&#x3001;&#x5934;&#x6587;&#x4EF6;&#x548C;&#x5E93;&#x3002;Python 2.7&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;&#x7ED3;&#x675F;&#x4E8E;2020&#x5E74;&#xFF0C;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x5C06;&#x4F7F;&#x7528;Python 3.5&#x3002;</p>
<p>&#x5728;Ubuntu 14.04 LTS&#x4E0A;(&#x8FD9;&#x662F;Travis CI&#x4F7F;&#x7528;&#x7684;&#x73AF;&#x5883;&#xFF0C;&#x6211;&#x4EEC;&#x540E;&#x9762;&#x4F1A;&#x8BA8;&#x8BBA;)&#xFF0C;Python 3.5&#x53EF;&#x4EE5;&#x5B89;&#x88C5;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">sudo apt-get install python3.5-dev
</code></pre>
<p>Windows&#x53EF;&#x4F7F;&#x7528;MSYS2&#x73AF;&#x5883;&#xFF0C;Python&#x5B89;&#x88C5;&#x65B9;&#x6CD5;&#x5982;&#x4E0B;(&#x5047;&#x8BBE;&#x662F;64&#x4F4D;&#x7248;&#x672C;):</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-python3
$ pacman -S mingw64/mingw-w64-x86_64-python3-pip
$ python3 -m pip install pipenv
</code></pre>
<p>&#x4E3A;&#x4E86;&#x8FD0;&#x884C;&#x5DF2;&#x7ECF;&#x5199;&#x597D;&#x7684;&#x6D4B;&#x8BD5;&#x673A;&#x5236;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x4E00;&#x4E9B;&#x7279;&#x5B9A;&#x7684;Python&#x6A21;&#x5757;&#x3002;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x5728;&#x7CFB;&#x7EDF;&#x8303;&#x56F4;&#x5185;&#x5B89;&#x88C5;&#x8FD9;&#x4E9B;&#x5305;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x9694;&#x79BB;&#x7684;&#x73AF;&#x5883;&#x4E2D;&#x5B89;&#x88C5;&#x3002;&#x5EFA;&#x8BAE;&#x91C7;&#x7528;&#x540E;&#x4E00;&#x79CD;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ul>
<li>&#x53EF;&#x4EE5;&#x5728;&#x4E0D;&#x5F71;&#x54CD;&#x7CFB;&#x7EDF;&#x73AF;&#x5883;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5C06;&#x5B89;&#x88C5;&#x5305;&#x8FDB;&#x884C;&#x6E05;&#x7406;/&#x5B89;&#x88C5;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x5728;&#x6CA1;&#x6709;&#x7BA1;&#x7406;&#x5458;&#x6743;&#x9650;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x5B89;&#x88C5;&#x5305;&#x3002;</li>
<li>&#x53EF;&#x4EE5;&#x964D;&#x4F4E;&#x8F6F;&#x4EF6;&#x7248;&#x672C;&#x548C;&#x4F9D;&#x8D56;&#x9879;&#x51B2;&#x7A81;&#x7684;&#x98CE;&#x9669;&#x3002;</li>
<li>&#x4E3A;&#x4E86;&#x590D;&#x73B0;&#x6027;&#xFF0C;&#x53EF;&#x4EE5;&#x66F4;&#x597D;&#x5730;&#x63A7;&#x5236;&#x5305;&#x7684;&#x4F9D;&#x8D56;&#x6027;&#x3002;</li>
</ul>
<p>&#x4E3A;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x51C6;&#x5907;&#x4E86;&#x4E00;&#x4E2A;<code>Pipfile</code>&#x3002;&#x7ED3;&#x5408;<code>pipfile.lock</code>&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>Pipenv</code>( <a href="http://pipenv.readthedocs" target="_blank">http://pipenv.readthedocs</a> )&#x3002;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x72EC;&#x7ACB;&#x7684;&#x73AF;&#x5883;&#xFF0C;&#x5E76;&#x5B89;&#x88C5;&#x6240;&#x6709;&#x5305;&#x3002;&#x8981;&#x4E3A;&#x793A;&#x4F8B;&#x5E93;&#x521B;&#x5EFA;&#x6B64;&#x73AF;&#x5883;&#xFF0C;&#x53EF;&#x5728;&#x5E93;&#x7684;&#x9876;&#x5C42;&#x76EE;&#x5F55;&#x4E2D;&#x8FD0;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-shell">$ pip install --user pip pipenv --upgrade
$ pipenv install --python python3.5
</code></pre>
<p>&#x6267;&#x884C;<code>pipenv shell</code>&#x547D;&#x4EE4;&#x4F1A;&#x8FDB;&#x5165;&#x4E00;&#x4E2A;&#x547D;&#x4EE4;&#x884C;&#x73AF;&#x5883;&#xFF0C;&#x5176;&#x4E2D;&#x5305;&#x542B;&#x7279;&#x5B9A;&#x7248;&#x672C;&#x7684;Python&#x548C;&#x53EF;&#x7528;&#x7684;&#x5305;&#x3002;&#x6267;&#x884C;<code>exit</code>&#x5C06;&#x9000;&#x51FA;&#x5F53;&#x524D;&#x73AF;&#x5883;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>pipenv run</code>&#x5728;&#x9694;&#x79BB;&#x7684;&#x73AF;&#x5883;&#x4E2D;&#x76F4;&#x63A5;&#x6267;&#x884C;&#x547D;&#x4EE4;&#x3002;</p>
<p>&#x6216;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x5E93;&#x4E2D;&#x7684;<code>requirements.txt</code>&#x6587;&#x4EF6;&#x4E0E;<code>Virtualenv</code>( <a href="http://docs.pythonguide.org/en/latest/dev/virtualenvs/" target="_blank">http://docs.pythonguide.org/en/latest/dev/virtualenvs/</a> )&#x548C;<code>pip</code>&#x7ED3;&#x5408;&#x4F7F;&#x7528;&#xFF0C;&#x4EE5;&#x8FBE;&#x5230;&#x76F8;&#x540C;&#x7684;&#x6548;&#x679C;&#xFF1A;</p>
<pre><code class="lang-shell">$ virtualenv --python=python3.5 venv
$ source venv/bin/activate
$ pip install -r requirements.txt
</code></pre>
<p>&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>deactivate</code>&#x547D;&#x4EE4;&#x9000;&#x51FA;&#x865A;&#x62DF;&#x73AF;&#x5883;&#x3002;</p>
<p>&#x53E6;&#x4E00;&#x79CD;&#x9009;&#x62E9;&#x662F;&#x4F7F;&#x7528;<code>Conda</code>&#x73AF;&#x5883;&#xFF0C;&#x6211;&#x4EEC;&#x5EFA;&#x8BAE;&#x5B89;&#x88C5;<code>Miniconda</code>&#x3002;&#x5C06;&#x628A;&#x6700;&#x65B0;&#x7684;<code>Miniconda</code>&#x5B89;&#x88C5;&#x5230;GNU/Linux&#x7684;<code>$HOME/Deps/conda</code>&#x76EE;&#x5F55;(&#x4ECE; <a href="https://repo.continuum.io/miniconda/miniconda3-latestlinux-x86_64.sh" target="_blank">https://repo.continuum.io/miniconda/miniconda3-latestlinux-x86_64.sh</a> &#x4E0B;&#x8F7D;)&#x6216;macOS(&#x4ECE; <a href="https://repo.continuum.io/miniconda/miniconda3-latestmacosx-x86_64.sh" target="_blank">https://repo.continuum.io/miniconda/miniconda3-latestmacosx-x86_64.sh</a> &#x4E0B;&#x8F7D;)&#xFF1A;</p>
<pre><code class="lang-shell">$ curl -Ls https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh &gt; miniconda.sh
$ bash miniconda.sh -b -p &quot;$HOME&quot;/Deps/conda &amp;&gt; /dev/null
$ touch &quot;$HOME&quot;/Deps/conda/conda-meta/pinned
$ export PATH=$HOME/Deps/conda/bin${PATH:+:$PATH}
$ conda config --set show_channel_urls True
$ conda config --set changeps1 no
$ conda update --all
$ conda clean -tipy
</code></pre>
<p>Windows&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE; <a href="https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe" target="_blank">https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe</a> &#x4E0B;&#x8F7D;&#x6700;&#x65B0;&#x7684;<code>Miniconda</code>&#x3002;&#x8BE5;&#x8F6F;&#x4EF6;&#x5305;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>PowerShell</code>&#x5B89;&#x88C5;&#xFF0C;&#x5982;&#x4E0B;:</p>
<pre><code class="lang-shell">$basedir = $pwd.Path + &quot;\&quot;
$filepath = $basedir + &quot;Miniconda3-latest-Windows-x86_64.exe&quot;
$Anaconda_loc = &quot;C:\Deps\conda&quot;
$args = &quot;/InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /S /D=$Anaconda_loc&quot;
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
$conda_path = $Anaconda_loc + &quot;\Scripts\conda.exe&quot;
$args = &quot;config --set show_channel_urls True&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
$args = &quot;config --set changeps1 no&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
$args = &quot;update --all&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
$args = &quot;clean -tipy&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
</code></pre>
<p>&#x5B89;&#x88C5;&#x4E86;<code>Conda</code>&#x540E;, Python&#x6A21;&#x5757;&#x53EF;&#x4EE5;&#x6309;&#x5982;&#x4E0B;&#x65B9;&#x5F0F;&#x5B89;&#x88C5;:</p>
<pre><code class="lang-shell">$ conda create -n cmake-cookbook python=3.5
$ conda activate cmake-cookbook
$ conda install --file requirements.txt
</code></pre>
<p>&#x6267;&#x884C;<code>conda deactivate</code>&#x5C06;&#x9000;&#x51FA;<code>conda</code>&#x7684;&#x73AF;&#x5883;&#x3002;</p>
<h2 id="035-&#x4F9D;&#x8D56;&#x8F6F;&#x4EF6;">0.3.5 &#x4F9D;&#x8D56;&#x8F6F;&#x4EF6;</h2>
<p>&#x6709;&#x4E9B;&#x793A;&#x4F8B;&#x9700;&#x8981;&#x989D;&#x5916;&#x7684;&#x4F9D;&#x8D56;&#xFF0C;&#x8FD9;&#x4E9B;&#x8F6F;&#x4EF6;&#x5C06;&#x5728;&#x8FD9;&#x91CC;&#x4ECB;&#x7ECD;&#x3002;</p>
<h3 id="0351-blas&#x548C;lapack">0.3.5.1 BLAS&#x548C;LAPACK</h3>
<p>&#x5927;&#x591A;&#x6570;Linux&#x53D1;&#x884C;&#x7248;&#x90FD;&#x4E3A;BLAS&#x548C;LAPACK&#x63D0;&#x4F9B;&#x5305;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5728;Ubuntu 14.04 LTS&#x4E0A;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x8FD0;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install libatlas-dev liblapack-dev liblapacke-dev
</code></pre>
<p>macOS&#x4E0A;&#xFF0C;XCode&#x9644;&#x5E26;&#x7684;&#x52A0;&#x901F;&#x5E93;&#x53EF;&#x4EE5;&#x6EE1;&#x8DB3;&#x6211;&#x4EEC;&#x7684;&#x9700;&#x8981;&#x3002;</p>
<p>Windows&#x4F7F;&#x7528;MSYS2&#x73AF;&#x5883;&#xFF0C;&#x53EF;&#x4EE5;&#x6309;&#x5982;&#x4E0B;&#x65B9;&#x5F0F;&#x5B89;&#x88C5;&#x8FD9;&#x4E9B;&#x5E93;(&#x5047;&#x8BBE;&#x662F;64&#x4F4D;&#x7248;&#x672C;)&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-openblas
</code></pre>
<p>&#x6216;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE;GitHub ( <a href="https://github.com/referlapack/lapack" target="_blank">https://github.com/referlapack/lapack</a> )&#x4E0B;&#x8F7D;BLAS&#x548C;LAPACK&#x7684;&#x53C2;&#x8003;&#x5B9E;&#x73B0;&#xFF0C;&#x5E76;&#x4ECE;&#x6E90;&#x4EE3;&#x7801;&#x7F16;&#x8BD1;&#x5E93;&#x3002;&#x5546;&#x4E1A;&#x4F9B;&#x5E94;&#x5546;&#x4E3A;&#x5E73;&#x53F0;&#x63D0;&#x4F9B;&#x5B89;&#x88C5;&#x7A0B;&#x5E8F;&#xFF0C;&#x5B89;&#x88C5;&#x5305;&#x4E2D;&#x6709;BLAS&#x548C;LAPACK&#x76F8;&#x5173;&#x7684;API&#x3002;</p>
<h3 id="0352-&#x6D88;&#x606F;&#x4F20;&#x9012;&#x63A5;&#x53E3;mpi">0.3.5.2 &#x6D88;&#x606F;&#x4F20;&#x9012;&#x63A5;&#x53E3;(MPI)</h3>
<p>MPI&#x6709;&#x8BB8;&#x591A;&#x5546;&#x4E1A;&#x548C;&#x975E;&#x5546;&#x4E1A;&#x5B9E;&#x73B0;&#x3002;&#x8FD9;&#x91CC;&#xFF0C;&#x5B89;&#x88C5;&#x514D;&#x8D39;&#x7684;&#x975E;&#x5546;&#x4E1A;&#x5B9E;&#x73B0;&#x5C31;&#x8DB3;&#x591F;&#x4E86;&#x3002;&#x5728;Ubuntu 14.04 LTS&#x4E0A;&#xFF0C;&#x6211;&#x4EEC;&#x63A8;&#x8350;<code>OpenMPI</code>&#x3002;&#x53EF;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x5B89;&#x88C5;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install openmpi-bin libopenmpi-dev
</code></pre>
<p>&#x5728;macOS&#x4E0A;&#xFF0C;<code>Homebrew</code>&#x53D1;&#x5E03;&#x4E86;<code>MPICH</code>&#xFF1A;</p>
<pre><code class="lang-shell">$ brew install mpich
</code></pre>
<p>&#x8FD8;&#x53EF;&#x4EE5;&#x4ECE; <a href="https://www.open-mpi.org/software/" target="_blank">https://www.open-mpi.org/software/</a> &#x4E0A;&#x83B7;&#x53D6;&#x6E90;&#x4EE3;&#x7801;&#xFF0C;&#x7F16;&#x8BD1;<code>OpenMPI</code>&#x3002;
&#x5BF9;&#x4E8E;Windows&#xFF0C;Microsoft MPI&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <a href="https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/bb524831(v=vs.85).aspx</a> &#x4E0B;&#x8F7D;&#x5B89;&#x88C5;&#x3002;</p>
<h3 id="0353-&#x7EBF;&#x6027;&#x4EE3;&#x6570;&#x6A21;&#x677F;&#x5E93;">0.3.5.3 &#x7EBF;&#x6027;&#x4EE3;&#x6570;&#x6A21;&#x677F;&#x5E93;</h3>
<p>&#x4E00;&#x4E9B;&#x793A;&#x4F8B;&#x9700;&#x8981;&#x7EBF;&#x6027;&#x4EE3;&#x6570;&#x6A21;&#x677F;&#x5E93;&#xFF0C;&#x7248;&#x672C;&#x4E3A;3.3&#x6216;&#x66F4;&#x9AD8;&#x3002;&#x5982;&#x679C;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x4E0D;&#x63D0;&#x4F9B;<code>Eigen</code>&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5728;&#x7EBF;&#x6253;&#x5305;&#x6E90;(<a href="http://eigen.tuxfamily.org" target="_blank">http://eigen.tuxfamily.org</a> )&#x5B89;&#x88C5;&#x5B83;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5728;GNU/Linux&#x548C;macOS&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;<code>Eigen</code>&#x5B89;&#x88C5;&#x5230;<code>$HOME/Deps/Eigen</code>&#x76EE;&#x5F55;:</p>
<pre><code class="lang-shell">$ eigen_version=&quot;3.3.4&quot;
$ mkdir -p eigen
$ curl -Ls http://bitbucket.org/eigen/eigen/get/${eigen_version}.tar.gz | tar -xz -C eigen --strip-components=1
$ cd eigen
$ cmake -H. -Bbuild_eigen -
DCMAKE_INSTALL_PREFIX=&quot;$HOME/Deps/eigen&quot; &amp;&gt; /dev/null
$ cmake --build build_eigen -- install &amp;&gt; /dev/null
</code></pre>
<h3 id="0354-boost&#x5E93;">0.3.5.4 Boost&#x5E93;</h3>
<p><code>Boost</code>&#x5E93;&#x9002;&#x7528;&#x4E8E;&#x5404;&#x79CD;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#xFF0C;&#x5927;&#x591A;&#x6570;Linux&#x53D1;&#x884C;&#x7248;&#x90FD;&#x901A;&#x8FC7;&#x5B83;&#x4EEC;&#x7684;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x63D0;&#x4F9B;&#x8BE5;&#x5E93;&#x7684;&#x5B89;&#x88C5;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5728;Ubuntu 14.04 LTS&#x4E0A;&#xFF0C;<code>Boost</code>&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x5E93;&#x3001;<code>Boost Python</code>&#x5E93;&#x548C;<code>Boost</code>&#x6D4B;&#x8BD5;&#x5E93;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x5B89;&#x88C5;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install libboost-filesystem-dev libboost-python-dev libboost-test-dev
</code></pre>
<p>&#x5BF9;&#x4E8E;macOS, <code>MacPorts</code>&#x548C;&#x81EA;&#x5236;&#x7A0B;&#x5E8F;&#x90FD;&#x4E3A;&#x6700;&#x65B0;&#x7248;&#x672C;&#x7684;<code>Boost</code>&#x63D0;&#x4F9B;&#x4E86;&#x5B89;&#x88C5;&#x5305;&#x3002;&#x6211;&#x4EEC;&#x5728;macOS&#x4E0A;&#x7684;&#x6D4B;&#x8BD5;&#x8BBE;&#x7F6E;&#x5B89;&#x88C5;<code>Boost</code>&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">$ brew cask uninstall --force oclint
$ brew uninstall --force --ignore-dependencies boost
$ brew install boost
$ brew install boost-python3
</code></pre>
<p>Windows&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x53D1;&#x884C;&#x7248;&#x4E5F;&#x53EF;&#x4EE5;&#x4ECE;<code>Boost</code>&#x7F51;&#x7AD9; <a href="http://www.boost.org" target="_blank">http://www.boost.org</a> &#x4E0B;&#x8F7D;&#x3002;&#x6216;&#x8005;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE; <a href="https://www.boost.org" target="_blank">https://www.boost.org</a> &#x4E0B;&#x8F7D;&#x6E90;&#x4EE3;&#x7801;&#xFF0C;&#x5E76;&#x81EA;&#x5DF1;&#x7F16;&#x8BD1;<code>Boost</code>&#x5E93;&#x3002;</p>
<h4 id="0355-&#x4EA4;&#x53C9;&#x7F16;&#x8BD1;&#x5668;">0.3.5.5 &#x4EA4;&#x53C9;&#x7F16;&#x8BD1;&#x5668;</h4>
<p>&#x5728;&#x7C7B;Debian/Ubuntu&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#x5B89;&#x88C5;&#x4EA4;&#x53C9;&#x7F16;&#x8BD1;&#x5668;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install gcc-mingw-w64 g++-mingw-w64 gfortran-mingw-w64
</code></pre>
<p>&#x5728;macOS&#x4E0A;&#xFF0C;&#x4F7F;&#x7528;<code>Brew</code>&#xFF0C;&#x53EF;&#x4EE5;&#x5B89;&#x88C5;&#x4EE5;&#x4E0B;&#x4EA4;&#x53C9;&#x7F16;&#x8BD1;&#x5668;&#xFF1A;</p>
<pre><code class="lang-shell">$ brew install mingw-w64
</code></pre>
<p>&#x5176;&#x4ED6;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x63D0;&#x4F9B;&#x76F8;&#x5E94;&#x7684;&#x5305;&#x3002;&#x4F7F;&#x7528;&#x6253;&#x5305;&#x7684;&#x8DE8;&#x7F16;&#x8BD1;&#x5668;&#x7684;&#x53E6;&#x4E00;&#x79CD;&#x65B9;&#x6CD5;&#xFF0C;&#x662F;&#x4F7F;&#x7528;M&#x4EA4;&#x53C9;&#x73AF;&#x5883;( <a href="https://mxe.cc" target="_blank">https://mxe.cc</a> )&#xFF0C;&#x5E76;&#x4ECE;&#x6E90;&#x4EE3;&#x7801;&#x5BF9;&#x5176;&#x8FDB;&#x884C;&#x6784;&#x5EFA;&#x3002;</p>
<h4 id="0356-zeromq-pkg-config-uuid&#x548C;doxygen">0.3.5.6 ZeroMQ, pkg-config, UUID&#x548C;Doxygen</h4>
<p>Ubuntu 14.04 LTS&#x4E0A;&#xFF0C;&#x8FD9;&#x4E9B;&#x5305;&#x53EF;&#x4EE5;&#x5B89;&#x88C5;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-shell">$ sudo apt-get install pkg-config libzmq3-dev doxygen graphviz-dev uuid-dev
</code></pre>
<p>macOS&#x4E0A;&#xFF0C;&#x6211;&#x4EEC;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;<code>Brew</code>&#x5B89;&#x88C5;&#xFF1A;</p>
<pre><code class="lang-shell">$ brew install ossp-uuid pkg-config zeromq doxygen
</code></pre>
<p><code>pkg-config</code>&#x7A0B;&#x5E8F;&#x548C;<code>UUID</code>&#x5E93;&#x53EA;&#x5728;&#x7C7B;Unix&#x7CFB;&#x7EDF;&#x4E0A;&#x53EF;&#x7528;&#x3002;
Windows&#x4E0A;&#x4F7F;&#x7528;MSYS2&#x73AF;&#x5883;&#xFF0C;&#x53EF;&#x4EE5;&#x6309;&#x5982;&#x4E0B;&#x65B9;&#x5F0F;&#x5B89;&#x88C5;&#x8FD9;&#x4E9B;&#x4F9D;&#x8D56;&#x9879;(&#x5047;&#x8BBE;&#x662F;64&#x4F4D;&#x7248;&#x672C;)&#xFF1A;</p>
<pre><code class="lang-shell">$ pacman -S mingw64/mingw-w64-x86_64-zeromq
$ pacman -S mingw64/mingw-w64-x86_64-pkg-config
$ pacman -S mingw64/mingw-w64-x86_64-doxygen
$ pacman -S mingw64/mingw-w64-x86_64-graphviz
</code></pre>
<h4 id="0357-conda&#x7684;&#x6784;&#x5EFA;&#x548C;&#x90E8;&#x7F72;">0.3.5.7 Conda&#x7684;&#x6784;&#x5EFA;&#x548C;&#x90E8;&#x7F72;</h4>
<p>&#x60F3;&#x8981;&#x4F7F;&#x7528;<code>Conda</code>&#x6253;&#x5305;&#x7684;&#x793A;&#x4F8B;&#x7684;&#x8BDD;&#xFF0C;&#x9700;&#x8981;<code>Miniconda</code>&#x548C;<code>Conda</code>&#x6784;&#x5EFA;&#x548C;&#x90E8;&#x7F72;&#x5DE5;&#x5177;&#x3002;<code>Miniconda</code>&#x7684;&#x5B89;&#x88C5;&#x8BF4;&#x660E;&#x4E4B;&#x524D;&#x5DF2;&#x7ECF;&#x7ED9;&#x51FA;&#x3002;&#x8981;&#x5728;GNU/Linux&#x548C;macOS&#x4E0A;&#x5B89;&#x88C5;<code>Conda</code>&#x6784;&#x5EFA;&#x548C;&#x90E8;&#x7F72;&#x5DE5;&#x5177;&#xFF0C;&#x8BF7;&#x8FD0;&#x884C;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;:</p>
<pre><code class="lang-shell">$ conda install --yes --quiet conda-build anaconda-client jinja2 setuptools
$ conda clean -tipsy
$ conda info -a
</code></pre>
<p>&#x8FD9;&#x4E9B;&#x5DE5;&#x5177;&#x4E5F;&#x53EF;&#x4EE5;&#x5B89;&#x88C5;&#x5728;Windows&#x4E0A;:</p>
<pre><code class="lang-shell">$conda_path = &quot;C:\Deps\conda\Scripts\conda.exe&quot;
$args = &quot;install --yes --quiet conda-build anaconda-client jinja2 setuptools&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
$args = &quot;clean -tipsy&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
$args = &quot;info -a&quot;
Start-Process -FilePath &quot;$conda_path&quot; -ArgumentList $args -Wait -Passthru
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="0.2-chinese.html" class="navigation navigation-prev " aria-label="Previous page: 0.2 Docker镜像">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="0.4-chinese.html" class="navigation navigation-next " aria-label="Next page: 0.4 测试环境">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"0.3 安装必要的软件","level":"1.3.3","depth":2,"next":{"title":"0.4 测试环境","level":"1.3.4","depth":2,"path":"content/chapter0/0.4-chinese.md","ref":"content/chapter0/0.4-chinese.md","articles":[]},"previous":{"title":"0.2 Docker镜像","level":"1.3.2","depth":2,"path":"content/chapter0/0.2-chinese.md","ref":"content/chapter0/0.2-chinese.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","search-pro","-sharing","github","pageview-count"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/arcticfox1919"},"search-pro":{},"pageview-count":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"陈晓伟 chenxiaowei","pdf":{"pageNumbers":false,"fontSize":30,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":30,"left":30,"top":30,"bottom":50}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"《CMake Cookbook》中文版","language":"zh-hans","gitbook":"*","description":"作为对《CMake Cookbook》英文版的中文翻译。","direction":"ltr"},"file":{"path":"content/chapter0/0.3-chinese.md","mtime":"2020-09-22T10:39:01.875Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-09-22T11:21:21.825Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

